<template>
  <div>
    <el-container>
      <el-header>
        <div class="logo">
          <img src="../../assets/comImg/logo.svg" alt="" />
          <a href="#">Chatriq</a>
        </div>
        <ul class="navright">
          <li><i class="el-icon-search"></i></li>
          <li><i class="el-icon-star-off"></i></li>
          <li><i class="el-icon-star-off"></i></li>
          <li><i class="el-icon-star-off"></i></li>
          <li><i class="el-icon-star-off"></i></li>
          <li class="person">
            <img src="../../assets/comImg/logo.svg" alt="" />
          </li>
        </ul>
      </el-header>
      <el-container class="mainbox">
        <el-aside width="80px">
          <ul class="asidenav">
            <li
              :class="{ sel: active === 'Chats' }"
              @click="$store.commit('SET_ACTIVE', 'Chats')"
            >
              <i class="el-icon-star-off"></i>
              <p>Chats</p>
            </li>
            <li
              :class="{ sel: active === 'Calls' }"
              @click="$store.commit('SET_ACTIVE', 'Calls')"
            >
              <i class="el-icon-star-off"></i>
              <p>Calls</p>
            </li>
            <li
              :class="{ sel: active === 'Contacts' }"
              @click="$store.commit('SET_ACTIVE', 'Contacts')"
            >
              <i class="el-icon-star-off"></i>
              <p>Contacts</p>
            </li>
            <li>
              <i class="el-icon-star-off"></i>
              <p>To-Do</p>
            </li>
            <li class="help">
              <i class="el-icon-star-off"></i>
              <p>Help</p>
            </li>
          </ul>
        </el-aside>
        <el-main>
          <component :is="active"></component>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState(['active']),
  },
  components: {
    Chats: require('./Chats.vue').default,
    Calls: require('./Calls.vue').default,
    Contacts: require('./Contacts.vue').default,
  },
}
</script>

<style lang="scss">
* {
  padding: 0;
  margin: 0;
}
ul {
  list-style: none;
}
a {
  text-decoration: none;
}
.el-header {
  height: 57px;
  padding: 8px 16px !important;
  background: #fff;
  box-sizing: content-box !important;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  .logo {
    width: 140px;
    display: flex;
    align-items: center;
    img {
      width: 50px;
    }
    a {
      font-size: 22px;
      font-weight: 600;
      margin-left: 20px;
      color: #000;
    }
  }
  .navright {
    display: flex;
    align-items: center;
    li {
      margin: 0 10px;
      color: #949aa2;
      i {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        text-align: center;
        line-height: 36px;
        cursor: pointer;
        &:hover {
          background: #ddd;
        }
      }
    }
  }
  .person {
    width: 50px;
    height: 50px;
    img {
      width: 100%;
      border-radius: 50%;
    }
  }
}

.el-aside {
  background-color: #fff;
  border-right: 1px solid #ddd;
  color: #333;
  text-align: center;
  position: fixed;
  z-index: 100;
}

.mainbox {
  margin-top: 76px;
}
.el-main {
  background-color: #fff;
  color: #333;
  margin-left: 80px;
}
.asidenav {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  li {
    width: 54px;
    height: 52px;
    cursor: pointer;
    padding: 9px 12px;
    p {
      font-size: 12px;
      margin-top: 8px;
    }
  }
  .sel {
    color: #ae6eea;
  }
  .help {
    margin-top: 270px;
  }
}
</style>
